﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong;
public partial class aspnet_admin_bock_FAQonLine_CX_FAQonLine_Edit : System.Web.UI.Page
{
    /// <summary>
    /// 数据操作通用类 实例 TextData
    /// </summary> 
    public TongUse TextData = new TongUse();


    /// <summary>
    /// 用户存放数据的临时表
    /// </summary>
    DataTable MyDt = new DataTable();


    /// <summary>
    /// id
    /// </summary>
    string id = "";
    public string Cid ="";
    protected void Page_Load(object sender, EventArgs e)
    {

        if (IsPostBack)
        {
            try
            {
                id = Request.QueryString["id"].Trim();

                PageSave(int.Parse(id));
            }
            catch
            {
                Response.Write("");
            }
        }

        PageLand_First();
        Cx_FAQonLine_Answer_Contont.Attributes.Add("style", "display: none");
        Cid = Cx_FAQonLine_Answer_Contont.ClientID;


    }

    /// <summary>
    /// 加载时出现的东东
    /// </summary>
    protected void PageLand_First()
    {


        try
        {
            id = Request.QueryString["id"].Trim();
            int.Parse(id);
            MyDt = TextData.SqlataSet("select * from [CX_FAQonLine] where Cx_FAQonLine_id=" + id + "").Tables[0];

            Cx_FAQonLine_id.Text = MyDt.Rows[0]["Cx_FAQonLine_id"].ToString().Trim();
            Cx_FAQonLine_Question_Name.Text = MyDt.Rows[0]["Cx_FAQonLine_Question_Name"].ToString().Trim();
            Cx_FAQonLine_Question.Text = MyDt.Rows[0]["Cx_FAQonLine_Question"].ToString().Trim();
            Cx_FAQonLine_Question_Contont.Text = MyDt.Rows[0]["Cx_FAQonLine_Question_Contont"].ToString().Trim();
            Cx_FAQonLine_Answer_Name.Text = MyDt.Rows[0]["Cx_FAQonLine_Answer_Name"].ToString().Trim();
            Cx_FAQonLine_Answer_Contont.Text = MyDt.Rows[0]["Cx_FAQonLine_Answer_Contont"].ToString().Trim();
            Cx_FAQonLine_PublicTime.Text = MyDt.Rows[0]["Cx_FAQonLine_PublicTime"].ToString().Trim();
            Cx_FAQonLine_Address.Text = MyDt.Rows[0]["Cx_FAQonLine_Address"].ToString().Trim();
            Cx_FAQonLine_Tel.Text = MyDt.Rows[0]["Cx_FAQonLine_Tel"].ToString().Trim();
            Cx_FAQonLine_EMail.Text = MyDt.Rows[0]["Cx_FAQonLine_EMail"].ToString().Trim();

        }
        catch
        {
            MyDt = TextData.SqlataSet("select * from [CX_FAQonLine]  ").Tables[0];
            Cx_FAQonLine_id.Text = MyDt.Rows[0]["Cx_FAQonLine_id"].ToString().Trim();
            Cx_FAQonLine_Question_Name.Text = MyDt.Rows[0]["Cx_FAQonLine_Question_Name"].ToString().Trim();
            Cx_FAQonLine_Question.Text = MyDt.Rows[0]["Cx_FAQonLine_Question"].ToString().Trim();
            Cx_FAQonLine_Question_Contont.Text = MyDt.Rows[0]["Cx_FAQonLine_Question_Contont"].ToString().Trim();
            Cx_FAQonLine_Answer_Name.Text = MyDt.Rows[0]["Cx_FAQonLine_Answer_Name"].ToString().Trim();
            Cx_FAQonLine_Answer_Contont.Text = MyDt.Rows[0]["Cx_FAQonLine_Answer_Contont"].ToString().Trim();
            Cx_FAQonLine_PublicTime.Text = MyDt.Rows[0]["Cx_FAQonLine_PublicTime"].ToString().Trim();
            Cx_FAQonLine_Address.Text = MyDt.Rows[0]["Cx_FAQonLine_Address"].ToString().Trim();
            Cx_FAQonLine_Tel.Text = MyDt.Rows[0]["Cx_FAQonLine_Tel"].ToString().Trim();
            Cx_FAQonLine_EMail.Text = MyDt.Rows[0]["Cx_FAQonLine_EMail"].ToString().Trim();
        }
    }


    protected void PageSave(int id)
    {


            try
            {

                if (Cx_FAQonLine_Question.Text != "" && Cx_FAQonLine_Answer_Name.Text.Length < 250 && Cx_FAQonLine_Answer_Contont.Text.Length<25000&&int.Parse(Cx_FAQonLine_Sort.Text.Trim())<=99999)
                {

                    TextData.SqlDataSave("update [CX_FAQonLine] Set  Cx_FAQonLine_Answer_Name='" + Cx_FAQonLine_Answer_Name.Text.Trim() + "',Cx_FAQonLine_Answer_Contont = '" + Cx_FAQonLine_Answer_Contont.Text.Trim() + "',Cx_FAQonLine_Sort=" + Cx_FAQonLine_Sort.Text.Trim() + "  where Cx_FAQonLine_id=" + id);

                    tt.Text = "回复成功" + Cx_FAQonLine_Question_Name.Text + "成功";


                }
                else
                {
                    tt.Text = "输入的回复为空或超过250个或不存在此关键字";

                }
            }
            catch
            {
                tt.Text = "更新不能执行";
            }

        
    }


}
